package com.bianmaba.spring.supports.data.beans.entity;


import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;

/**
 * 基本实体类，此类包含ID,创建人，创建时间等字段，一个子类一个表，父类不会生成表。
 *
 * @author cWX183898
 */
@MappedSuperclass
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public abstract class PkEntity implements IEntity {
    private static final long serialVersionUID = -5841448194726953221L;

    @Id
    @GenericGenerator(name = "uuidGenerator", strategy = "uuid")
    @GeneratedValue(generator = "uuidGenerator", strategy = GenerationType.IDENTITY)
    @Column(length = 36, nullable = false)
    protected String pk;

    public String getPk() {
        return pk;
    }

    public void setPk(String pk) {
        this.pk = pk;
    }

    public String getId() {
        return pk;
    }

    public void setId(String pk) {
        this.pk = pk;
    }


}
